package lt.liepasoft.locr;

import java.util.List;

import lt.liepasoft.locr.data.Bounds;
import lt.liepasoft.locr.data.OcrImage;
import lt.liepasoft.locr.data.Symbol;

public abstract class Scanner {
    protected int whiteThreshold;        
    protected boolean invert; 
    
    public abstract List<Symbol> scan(OcrImage image, Bounds bounds);

    public void setInvert(boolean invert) {
        this.invert = invert;
    }

    public boolean isInvert() {
        return invert;
    }
        
    public void setWhiteThreshold(int whiteThreshold) {
        this.whiteThreshold = whiteThreshold;
    }

    public int getWhiteThreshold() {
        return whiteThreshold;
    }
    
    protected boolean isWhitePixel(byte pixel){
        return (!invert) ? pixel >= whiteThreshold : pixel < whiteThreshold;        
    }
}
